package com.yadang.infra.controller;

import com.yadang.infra.base.ApiResult;
import com.yadang.infra.bean.CmmDictType;
import com.yadang.infra.bean.dto.CmmDictDto;
import com.yadang.infra.service.CmmDictDetailService;
import com.yadang.infra.service.CmmDictService;
import com.yadang.infra.service.CmmDictTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;

@Api(tags = "OOM类")
@RestController
@RequestMapping("/infra/cmmDict")
public class OomController {
    private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
    static class OOMObject {
    }

    @ApiOperation("测试OOM")
    @PostMapping("insertOOM")
    public ApiResult<?> insertOOM(String str) {

        /*int count = 0;
        while (true){
            byte[] bytes = new byte[1024*1024*1024*1024*100000];
            LOGGER.info("第[{}]次创建字节对象！！",count++);
        }*/
        List<OOMObject> list = new ArrayList<OOMObject>();
        while (true) {
            list.add(new OOMObject());
        }
    }



}
